package com.lmiot.xyclick.Share;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;
import com.lmiot.xyclick.Activity.BaseActivity;
import com.lmiot.xyclick.App.MyApp;
import com.lkx.liandianqinew.R;
import com.lmiot.xyclick.Share.inteface.OnSearchListener;
import com.lmiot.xyclick.Util.PhoneUtil;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
import com.xiaoyi.intentsdklibrary.Bean.ShareBean;
import com.yanzhenjie.recyclerview.swipe.widget.DefaultItemDecoration;
import com.youyi.yyviewsdklibrary.View.TitleBarView;
import java.util.ArrayList;
import java.util.List;

public class ShareSelfActivity extends BaseActivity {
    TextView mIdEmpty;
    TitleBarView mIdTitleBar;
    private LinearLayoutManager mLayoutManager;
    RecyclerView mRecyclerView;
    SmartRefreshLayout mRefreshLayout;
    private ShareAdapter mShareAdapter;

    /* access modifiers changed from: protected */
    @Override // android.support.v7.app.AppCompatActivity, android.support.v4.app.SupportActivity, android.support.v4.app.FragmentActivity, com.lmiot.xyclick.Activity.BaseActivity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_share_self);
        initView();
        setTitle();
        this.mRecyclerView.addItemDecoration(new DefaultItemDecoration(getResources().getColor(R.color.transparent), -1, 20, 99));
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, 1, false);
        this.mLayoutManager = linearLayoutManager;
        this.mRecyclerView.setLayoutManager(linearLayoutManager);
        this.mRecyclerView.setFocusable(false);
        setRresh();
        setTitle();
    }

    private void setRresh() {
        this.mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
            /* class com.lmiot.xyclick.Share.ShareSelfActivity.AnonymousClass1 */

            @Override // com.scwang.smart.refresh.layout.listener.OnRefreshListener
            public void onRefresh(RefreshLayout refreshLayout) {
                refreshLayout.finishRefresh(2000);
                ShareSelfActivity.this.getSelfShare();
            }
        });
    }

    @Override // android.support.v4.app.FragmentActivity, com.lmiot.xyclick.Activity.BaseActivity
    public void onResume() {
        super.onResume();
        getSelfShare();
    }

    private void setTitle() {
        this.mIdTitleBar.setOnItemClickListener(new TitleBarView.onItemClickListener() {
            /* class com.lmiot.xyclick.Share.ShareSelfActivity.AnonymousClass2 */

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onMenuClick(View view) {
            }

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onTitleClick(View view) {
            }

            @Override // com.youyi.yyviewsdklibrary.View.TitleBarView.onItemClickListener
            public void onBackClick(View view) {
                ShareSelfActivity.this.finish();
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void getSelfShare() {
        ShareSDK.getInstance().searchSelfFile(PhoneUtil.getIMEI(MyApp.getContext()), new OnSearchListener() {
            /* class com.lmiot.xyclick.Share.ShareSelfActivity.AnonymousClass3 */

            @Override // com.lmiot.xyclick.Share.inteface.OnSearchListener
            public void result(boolean z, List<ShareBean> list) {
                ShareSelfActivity.this.showListView(list);
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void showListView(List<ShareBean> list) {
        if (list == null) {
            list = new ArrayList<>();
        }
        if (list.size() == 0) {
            this.mIdEmpty.setVisibility(View.VISIBLE);
        } else {
            this.mIdEmpty.setVisibility(View.GONE);
        }
        ShareAdapter shareAdapter = new ShareAdapter(this, list, true);
        this.mShareAdapter = shareAdapter;
        this.mRecyclerView.setAdapter(shareAdapter);
        this.mRecyclerView.setNestedScrollingEnabled(false);
    }

    /* access modifiers changed from: protected */
    @Override // android.support.v7.app.AppCompatActivity, android.support.v4.app.FragmentActivity, com.lmiot.xyclick.Activity.BaseActivity
    public void onDestroy() {
        super.onDestroy();
    }

    private void initView() {
        this.mIdTitleBar = (TitleBarView) findViewById(R.id.id_title_bar);
        this.mIdEmpty = (TextView) findViewById(R.id.id_empty);
        this.mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
        this.mRefreshLayout = (SmartRefreshLayout) findViewById(R.id.refreshLayout);
    }
}
